/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pa165.languageschoolpersistence.DAO;

import com.pa165.languageschoolpersistence.Exceptions.IllegalArgumentPersistenceException;
import com.pa165.languageschoolpersistence.Exceptions.ServiceFailureException;
import com.pa165.languageschoolpersistence.entities.Course;
import com.pa165.languageschoolpersistence.entities.Lector;
import com.pa165.languageschoolpersistence.entities.Lecture;
import com.pa165.languageschoolpersistence.entities.Student;
import java.util.List;

/**
 *
 * @author Elena Medvedeva
 *
 * This Interface represents DAO for handling Lectures It contains basic CRUD
 * operations. Then additional operations are added : - find lectures by Student
 * - find lectures by Course - find lectures by Lecture
 */
public interface LectureDAO {

    /**
     * Method for adding a Lecture for the course - lecture.getCourse() . For
     * conventions of a valid course see Lecture entity. If a lecture is not in
     * the database, it returns the course added. If a lecture is already in the
     * database, it returns a null value.
     *
     * @param lecture course to be added.
     * @return Null if already in database, lecture added instead
     * @throws IllegalArgumentPersistenceException if lecture is invalid
     * @throws ServiceFailureException if a problem during adding occures.
     */
    public Lecture add(Lecture lecture) throws ServiceFailureException;

    /**
     * Method for removing Lecture. For conventions of a valid course see
     * Lecture entity.
     *
     * @param lecture lecture to be removed.
     * @throws IllegalArgumentPersistenceException if lecture is not in the db
     * @throws ServiceFailureException is a problem during removal occures
     */
    public void remove(Lecture lecture) throws IllegalArgumentPersistenceException;

    /**
     * Method for modifying Lectures. For conventions of a valid course see
     * Lecture entity.
     *
     * @param lecture lecture to be modified.
     * @return Modified Lecture.
     * @throws IllegalArgumentPersistenceException if lecture is invalid or if
     * lecture is not in the database.
     * @throws ServiceFailureException if a problem during modification occures
     */
    public Lecture modify(Lecture lecture) throws IllegalArgumentPersistenceException;

    /**
     * Method for retrieving Lectures. For conventions of a valid course see
     * Lecture entity. Method gets course by input ID.
     *
     * @param id ID to be searched for.
     * @return Null if not in database, Lecture found instead
     * @throws IllegalArgumentPersistenceException if id is invalid(for details
     * see Lecture entity)
     * @throws ServiceFailureException if a problem during search occures.
     */
    public Lecture get(Long id) throws IllegalArgumentPersistenceException;

    /**
     * Method for retrieving all Lecture. For conventions of a valid course see
     * Lecture entity. Method gets all courses.
     *
     * @return Empty list if no lectures , list of courses found instead
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lecture> getAll();

    /**
     * Method for retrieving all Lecture taught by given lector. For conventions
     * of a valid course see Lecture entity. Method gets all courses.
     *
     * @param lector lector who teaches lectures.
     * @return Empty list if no lectures , list of courses found instead
     * @throws IllegalArgumentPersistenceException if lector is not present in
     * the db
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lecture> getLectures(Lector lector) throws IllegalArgumentPersistenceException;

    /**
     * Method for retrieving all Lecture in the given course. For conventions of
     * a valid course see Lecture entity. Method gets all courses.
     *
     * @param course course which contains lectures.
     * @return Empty list if no lectures , list of courses found instead
     * @throws IllegalArgumentPersistenceException if course is not present in
     * the db
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lecture> getLectures(Course coure) throws IllegalArgumentPersistenceException;

    /**
     * Method for retrieving all Lecture for the given student. For conventions
     * of a valid course see Lecture entity. Method gets all courses.
     *
     * @param student student who enrolled for the lectures.
     * @return Empty list if no lectures , list of courses found instead
     * @throws IllegalArgumentPersistenceException if student is not present in
     * the db
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lecture> getLectures(Student student) throws IllegalArgumentPersistenceException;
}
